package com.wms.controller;

import dev.langchain4j.model.chat.ChatModel;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : 阿盛哟
 * @description : 测试多模型调用
 * @createDate : 2025/7/1 16:33
 */
@RestController
@Slf4j
public class Hello {

    @Resource(name = "chatModelQWen")
    private ChatModel chatModelQWen;
    @Resource(name = "chatModelDeepSeek")
    private ChatModel chatModelDeepSeek;

    //http://localhost:9002/langchain4j/tongyi
    @GetMapping("langchain4j/tongyi")
    public String tongyi(@RequestParam(value = "question",defaultValue = "hello,你是谁") String question) {

        String result = chatModelQWen.chat(question);
        System.out.println("调用大模型回复："+result);
        return result;
    }


    //http://localhost:9002/langchain4j/deepseek
    @GetMapping("langchain4j/deepseek")
    public String deepseek(@RequestParam(value = "question",defaultValue = "hello,你是谁") String question) {

        String result = chatModelDeepSeek.chat(question);
        System.out.println("调用大模型回复："+result);
        return result;
    }
}